package com.xipu.yygh.login.controller;

import com.xipu.yygh.common.result.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * description: 登录接口
 * @author: gql
 * @date: 2022/04
 */
@Api(tags = "登录接口")
@RestController
@RequestMapping("/admin/background/user")
public class UserLoginController {

    @ApiOperation("登录")
    @PostMapping("/login")
    public R login() {
        return R.ok().data("token", "admin-token");
    }

    @ApiOperation("获取信息")
    @GetMapping("/info")
    public R info() {
        return R.ok().data("roles", "admin")
                .data("introduction", "I am a super administrator")
                // 头像
                .data("avatar", "https://hospital-yygh.oss-cn-beijing.aliyuncs.com/%E5%B0%8F%E8%93%9D%E5%A4%B4.jpg")
                .data("name", "超级管理员");
    }

    @ApiOperation("注销")
    @PostMapping("/logout")
    public R logout() {
        return R.ok();
    }
}
